package com.wksc.demo.authority.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 框架页面跳转控制器
 *
 */
@Controller
@RequestMapping("/portal")
public class PortalController {
    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public String login() {
        return "/portal/login";
    }

    @RequestMapping("/register")
    public String register(){

        return "/portal/register";
    }

    @RequestMapping(value = "/init", method = RequestMethod.GET)
    public String init() {
        return "/portal/main";
    }

    @RequestMapping(value = "/invalid", method = RequestMethod.GET)
    public String invalid() {
        return "/portal/invalid";
    }

    @RequestMapping(value = "/expired", method = RequestMethod.GET)
    public String expired() {
        return "/portal/expired";
    }

    @RequestMapping(value = "/accessDenied", method = RequestMethod.GET)
    public String accessDenied() {
        return "/portal/accessDenied";
    }

    @RequestMapping(value = "/home", method = RequestMethod.GET)
    public String initHome() {
        return "/portal/home";
    }

    @RequestMapping("/updateSelf")
    public String updateSelf(){
//        CurSessionUser loginUser = UserUtil.getUser();
//        if(loginUser.getUserType() == 2){
//
//            return "redirect:/student/getSelf.do";
//        }else if(loginUser.getUserType() == 1){
//
//            return "redirect:/teacher/getSelfUrl.do";
//        }
        return "";
    }

    @RequestMapping("/record")
    public String record(){
//        CurSessionUser loginUser = UserUtil.getUser();
//        if(loginUser.getUserType() == 2){
//
//            return "redirect:/student/record.do";
//        }else if(loginUser.getUserType() == 1){
//
//            return "redirect:/teacher/record.do";
//        }
        return "";
    }

    @RequestMapping("/license")
    public String getLicense(){
//        CurSessionUser loginUser = UserUtil.getUser();
//        if(loginUser.getUserType() == 2){
//
//            return "redirect:/student/license.do";
//        }else if(loginUser.getUserType() == 1){
//
//            return "redirect:/teacher/license.do";
//        }
        return "";
    }

    @RequestMapping("/redirectEtCafuc")
    public String redirectEtCafuc(Model model) {
//        CurSessionUser loginUser = UserUtil.getUser();
//        model.addAttribute("username", loginUser.getUsername());
//        model.addAttribute("password", loginUser.getPassword());
//        model.addAttribute("userType", loginUser.getUserType());
        return "/portal/redirectEtCafuc";
    }
}
